# Stats - IRC Statistical Services for Hybrid, csircd, and IRCnet 2.10
# Makefile - sgml/ Makefile
#
# Copyright W. Campbell and others.  See README for more details
# Some code Copyright: Jonathan George, Kai Seidler, ircd-hybrid Team,
#                      IRCnet IRCD developers.
#
# $Id: Makefile,v 1.6 2004/01/09 01:37:56 wcampbel Exp $

SGMLBASE = /usr/local/share/sgml
JADE = jade
CATALOGS = -c ${SGMLBASE}/docbook/dsssl/modular/catalog \
  -c ${SGMLBASE}/docbook/catalog \
  -c ${SGMLBASE}/jade/catalog
HTMLDSS = -d ${SGMLBASE}/docbook/dsssl/modular/html/docbook.dsl
PRINTDSS = -d ${SGMLBASE}/docbook/dsssl/modular/print/docbook.dsl

TIDY = tidy
LINKS = elinks
TEX = tex
DVIPS = dvips
PDFTEX = pdftex
NSGMLS = nsgmls

.SUFFIXES: .sgml .html .txt .rtf .tex .dvi .ps .pdf .test

SGML = \
	FLAGS.sgml \
	INSTALL.sgml \
	README.sgml \
	challenge.sgml \
	html-README.sgml

HTML = ${SGML:.sgml=.html}
TXT = ${HTML:.html=.txt}
TEXFILES = ${SGML:.sgml=.tex}
RTF = ${SGML:.sgml=.rtf}

default: $(TXT)

.html.txt:
	$(LINKS) -dump $< > $@

.sgml.html:
	$(JADE) -V nochunks $(CATALOGS) $(HTMLDSS) -t sgml $< > $@
	-$(TIDY) -m -q $@

.sgml.test:
	$(NSGMLS) -s $<

.sgml.rtf:
	$(JADE) $(CATALOGS) $(PRINTDSS) -t rtf $<

.sgml.tex:
	$(JADE) -V tex-backend $(CATALOGS) $(PRINTDSS) -t tex $<

# Yes, three runs are required.
.tex.dvi:
	$(TEX) "&jadetex" $<
	$(TEX) "&jadetex" $<
	$(TEX) "&jadetex" $<

.dvi.ps:
	$(DVIPS) -o $@ $<

.tex.pdf:
	$(PDFTEX) "&pdfjadetex" $<
	$(PDFTEX) "&pdfjadetex" $<
	$(PDFTEX) "&pdfjadetex" $<

clean:
	rm -f *.pdf *.tex *.ps *.dvi *.tex *.rtf *.txt *.html *.out *.log *.aux
